package com.zxl.grocery.core.mutidatasource;

/**
 * datasource的上下文
 * Created by Lzx on 2017/7/30
 */
public class DataSourceContextHolder {

    private static final ThreadLocal<String> contextHolder = new ThreadLocal<String>();

	/**
	 * @Description: 设置数据源类型
	 * @param dataSourceType 数据库类型
	 */
	public static void setDataSourceType(String dataSourceType) {
		contextHolder.set(dataSourceType);
	}

	/**
	 * @Description: 获取数据源类型
	 */
	public static String getDataSourceType() {
		return contextHolder.get();
	}

	/**
	 * @Description: 清除数据源类型
	 */
	public static void clearDataSourceType() {
		contextHolder.remove();
	}
}
